<?php
/**
 * Created by PhpStorm.
 * User: hebidu
 * Date: 15/10/8
 * Time: 22:08
 */

namespace Home\Controller;


use Shop\Api\MemberConfigApi;
use Common\Api\AccountApi;
use Admin\Api\UidMgroupApi;
use Shop\Api\WalletApi;
use Shop\Api\WalletHisApi;


class UserController extends AppBaseController {


    public function _initialize(){
        parent::_initialize();
    }

	/**
	 * 用户提现界面
	 */
	 public function outmoney(){
         $result =apiCall(WalletApi::GET_INFO_If_NOT_EXIST_THEN_ADD,array($this->uid));

         if(!$result['status']){
             $this->error($result['info']);
         }
         $this->assign("wallet",$result['info']);
         $this->theme($this->themeType)->display();
    }
	


    /**
     * 用户分享页面
     */
    public function share(){
      	$id=$this->uid;

		$user=apiCall(AccountApi::GET_INFO,array($id));

		$this->assign('user',$user['info']);
		$return=apiCall(UidMgroupApi::QUERY_WITH_UID,array($id));
		$this->assign('umember',$return['info'][0]);

        $share_link = C('SITE_URL')."/index.php/Home/InviteRegister/index?uid=".$this->uid;

        $this->assign("share_link",$share_link);
        $this->theme($this->themeType)->display();
    }

    /**
     * 用户返佣页面
     */
    public function rebate(){

        //TODO: 查询用户相关信息

        $result = apiCall(WalletApi::GET_INFO_If_NOT_EXIST_THEN_ADD,array($this->uid));
        if(!$result['status']){
            $this->error($result['info']);
        }

        $this->assign('wallet',$result['info']);

        $map['dtree_type'] = getDatatree("COMMISSION_ORDER_PAID");
        $result=apiCall(WalletHisApi::QUERY_NO_PAGING,array($map));
        $this->assign('jilu',$result['info']['list']);

        $this->theme($this->themeType)->display();
    }

	/**
	 * 物流
	 */
	public function express(){
		$this->theme($this->themeType)->display();
	}




    //===私有


}